import Vue from 'vue'
import request from '@/itsoftUI/utils/request'
import qs from "qs"
const baseUrl = Vue.prototype.$itsoftUI.config.serviceUrl + "/residence"
    //服务单位api
const chooseRoomApi = {
    // 楼宇下拉
    buildingList: function() {
        const data = {};
        return request({
            url: baseUrl + "/houseBuilding/buildingList",
            method: "post",
            data: qs.stringify(data)
        });
    },
    //房间下拉
    getRoomList: function(buildingId) {
        const data = {
            buildingId
        };
        return request({
            url: baseUrl + "/houseRoom/getRoomList  ",
            method: "post",
            data: qs.stringify(data)
        });
    },
    //人员类别
    getItemDetail: function() {
        let item = "userInfo"
        let name = "人员类别"
        const data = {
            item,
            name,

        }
        return request({
            url: baseUrl + '/houseDataType/getItemDetail',
            method: 'post',
            data: qs.stringify(data)
        })
    },
    //选房批次
    getOptionalBatch: function() {
        const data = {

        };
        return request({
            url: baseUrl + "/selectionBatch/getOptionalBatch",
            method: "post",
            data: qs.stringify(data)
        });
    },
    save: function(data) {
        const config = {
            headers: {
                'Content-Type': 'application/json;charset=utf-8'
            },
        }
        return request.post(baseUrl + "/selectionApplyInfo/save", data, config)
    },
    //获取登录人信息
    getLoginUserInfo: function() {
        const data = {};
        return request({
            url: baseUrl + "/selectionApplyInfo/getLoginUserInfo",
            method: "post",
            data: qs.stringify(data)
        });
    },
    //获取登录人信息
    getUserInfobyBatchId: function(batchId) {
        const data = {batchId};
        return request({
            url: baseUrl + "/selectionApplyInfo/getUserInfobyBatchId",
            method: "post",
            data: qs.stringify(data)
        });
    },
    //查询是否申请过此批次
    getIsThisBatchHasSelected: function(account, batchId) {
        const data = {
            account,
            batchId
        };
        return request({
            url: baseUrl + "/selectionBatch/isThisBatchHasSelected",
            method: "post",
            data: qs.stringify(data)
        });
    },
}
export {
    chooseRoomApi
}
